# -*- coding: utf-8 -*-
# @Time : 2024/2/18 15:11
# @Author : ZH
# @File : 45.py
# @Software: PyCharm
from typing import List


class Solution:
    def jump(self, nums: List[int]) -> int:
        max_pos, end, step = 0, 0, 0
        for i in range(len(nums)-1):
            if max_pos >= i:
                max_pos = max(max_pos, i + nums[i])
                if i == end:
                    end = max_pos
                    step += 1
        return step
